{extend name='common/common' /}

{block name="content"}
<el-row>
<el-col :md="12">
<el-card class="box-card">
	<div slot="header">
		<span class="span-primary"><i class="fa fa-plus"></i></span>
		添加县域年度资金
	</div>
	<div class="FormBox">
		<el-form ref="form" :model="form" label-width="120px" inline>
			<el-form-item label="资金年份">
				<el-date-picker
					v-model="form.year"
					type="year" value-format="yyyy"
					placeholder="选择年份">
				</el-date-picker>
			</el-form-item>
			<el-form-item label="资金（万元）">
				<el-input
					v-model="form.capital" min="0"
					placeholder="请填写金额"
					prefix-icon="fa fa-money"
					type="number">
				</el-input>
			</el-form-item><br>
			<el-form-item label=" ">
				<el-button type="primary" plain @click="subForm">提交</el-button>
			</el-form-item>
		</el-form>
	</div>
</el-card>
</el-col>
</el-row>
{/block}

{block name="script"}
<script type="text/javascript">
var main = new Vue({
	el:"#main",
	data:{
		loading:false,
		form:{
			year:"{$year}",capital:"",
			row_id:"{$target.id}",
			depart_id:"{$target.depart_id}",
			depart_name:"{$target.depart_name}"
		}
	},
	methods:{
		subForm() {
			var param = this.form;
			$.post("./saveYear",param,function(res){
				main.AjaxResponse(res);
			});
		},
		AjaxResponse(res) {
			if(res.code == 1){
				main.$notify({title:"成功",type:"success",message:res.msg});
			}else{
				main.$notify.error({title:"错误",message:res.msg});
			}
		}
	}
})
</script>
{/block}
